function listByCondition(categoryIdArray,orgCodeArray,categoryCode,orgType,indexLoad){
	window.location = "./findAllByCondition.action?categoryIdArray="+categoryIdArray+"&orgCodeArray="+orgCodeArray+"&categoryCode="+categoryCode+"&orgType="+orgType+"&indexLoad="+indexLoad;
}

/**
 * ajax首页根据不同的现实要求显示govInfo信息
 * @param {} categoryIdArray
 * @param {} orgCodeArray
 * @param {} categoryCode
 * @param {} orgType
 */
function indexChange(categoryIdArray,orgCodeArray,categoryCode,orgType,position,obj){
	if (obj != null && obj != '' && obj != "undefind") {
		obj.className = "over";
	}
	var html = "";
	$.ajax({
			url:"findByCondition.action",
			dataType:"json",
			type:"POST",
			data:"orgType="+orgType+"&categoryIdArray="+categoryIdArray+"&orgCodeArray="+orgCodeArray+"&categoryCode="+categoryCode,
			async: false,
			success:function(data){
				var govInfoList = data.govInfoList;
				html += " <table class='tb1' border='0' cellpadding='0' cellspacing='0'>";
				html += "<tbody>";
				if(govInfoList != null && govInfoList.length >0){
				  for(var i=0;i<govInfoList.length;i++){
					html += "<tr>";
					html += "<td><div class=\"title\">·<a href='./loadGovInfo.action?detailFlg=index&forwardKey=homeSite&orgType="+orgType+"&affairSort="+govInfoList[i].affairSort+"&nid="+govInfoList[i].id+"' onmouseover='over(event,this)' onmouseout='out(event,this)' title='"+
						 "<table cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed;font-size:13px;line-height:22px\">"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>索引号</b></td>"+
						 "<td>:"+(govInfoList[i].searchCode==null?"":govInfoList[i].searchCode)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td  valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>分类</b></td>"+
						 "<td>:"+(govInfoList[i].categoryName==null?"":govInfoList[i].categoryName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布机构</b></td>"+
						 "<td>:"+(govInfoList[i].orgName==null?"":govInfoList[i].orgName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布日期</b></td>"+
						 "<td>:"+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"</td>"+
						 "</tr><tr><td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>名称</b></td>"+
						 "<td>:"+(govInfoList[i].title==null?"":govInfoList[i].title)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>文号</b></td>"+
						 "<td>:"+(govInfoList[i].fwwh==null?"":govInfoList[i].fwwh)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>关键字</b></td>"+
						 "<td>:"+(govInfoList[i].keywords==null?"":govInfoList[i].keywords)+"</td>"+
						 "</tr>"+
						 "</table>'>";
					if(govInfoList[i].title.length>25){
						html += govInfoList[i].title.substring(0,25)+"...";
					} else {
						html += govInfoList[i].title;	
					} 
					html += "</a></div></td><td></td><td><div class=\"time\">["+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"]</div></td>";
					html += "</tr>";
				}
				}
		
				html += "</tbody></table>";
				$("#"+position).html("");
				$("#"+position).html(html);
			},
			error:function(){
				//alert("error!");
			}
	});
}

/**
 * ajax事件获取法规文件某组织机构类别的最新公开目录信息
 * @param {} orgType
 */
function changeByOrgType(categoryIdArray,orgCodeArray,categoryCode,orgType,obj){
	if(obj != null && obj != '' && obj != "undefind"){
		obj.className="over";
	}
	var html ="";
	$.ajax({
			url:"findByCondition.action",
			dataType:"json",
			type:"POST",
			data:"orgType="+orgType+"&categoryIdArray="+categoryIdArray+"&orgCodeArray="+orgCodeArray+"&categoryCode="+categoryCode,
			async: false,
			success:function(data){
				var govInfoList = data.govInfoList;
				html += " <table class='tb1' border='0' cellpadding='0' cellspacing='0'>";
				html +="<th width='50%'>标题</th><th width='25%'><div style='float:right;margin-right:13px'>发文时间</div></th>";
				html += "<tbody>";
				if(govInfoList != null && govInfoList.length >0){
				  for(var i=0;i<govInfoList.length;i++){
					html += "<tr>";
					html += "<td><span class='title'>·<a href='./loadGovInfo.action?detailFlg=index&forwardKey=homeSite&orgType="+orgType+"&affairSort="+govInfoList[i].affairSort+"&nid="+govInfoList[i].id+"' onmouseover='over(event,this)' onmouseout='out(event,this)' title='"+
						 "<table cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed;font-size:13px;line-height:22px\">"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>索引号</b></td>"+
						 "<td>:"+(govInfoList[i].searchCode==null?"":govInfoList[i].searchCode)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td  valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>分类</b></td>"+
						 "<td>:"+(govInfoList[i].categoryName==null?"":govInfoList[i].categoryName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布机构</b></td>"+
						 "<td>:"+(govInfoList[i].orgName==null?"":govInfoList[i].orgName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布日期</b></td>"+
						 "<td>:"+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"</td>"+
						 "</tr><tr><td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>名称</b></td>"+
						 "<td>:"+(govInfoList[i].title==null?"":govInfoList[i].title)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>文号</b></td>"+
						 "<td>:"+(govInfoList[i].fwwh==null?"":govInfoList[i].fwwh)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>关键字</b></td>"+
						 "<td>:"+(govInfoList[i].keywords==null?"":govInfoList[i].keywords)+"</td>"+
						 "</tr>"+
						 "</table>'>";
					if(govInfoList[i].title.length>25){
						html += govInfoList[i].title.substring(0,25)+"...";
					} else {
						html += govInfoList[i].title;	
					} 
					html += "</a></span></td><td><div class=\"time\" style=\"float:right;margin-right:10px\">["+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"]</div></td>";
					html += "</tr>";
				}
					
			}
			
				html += "</tbody></table>";
				$("#headInfo").html("");
				$("#headInfo").html(html);
			},
			error:function(){
				//alert("error!");
			}
	});
}

 /**
  * ajax事件获取某公开目录的信息
  * @param {} categoryId
  * @param {} position
  * @return {}
  */
	function changeCon(categoryId,orgType,position,obj){
		if(obj != null && obj != "undifined"){
			obj.className="over";
		}
		var html = "";
		$.ajax({
			url:"findGovInfoList.action",
			dataType:"json",
			type:"POST",
			data:"categoryId="+categoryId+"&orgType="+orgType,
			async: false,
			success:function(data){
				var govInfoList = data.govInfoCyList;
				html += " <table class='tb1' border='0' cellpadding='0' cellspacing='0'>";
				html += "<tbody>";
				if(govInfoList != null && govInfoList.length >0){
				  for(var i=0;i<govInfoList.length;i++){
					html += "<tr>";
					html += "<td><div class='title'>·<a href='./loadGovInfo.action?detailFlg=index&forwardKey=homeSite&orgType="+orgType+"&affairSort="+govInfoList[i].affairSort+"&nid="+govInfoList[i].id+"' onmouseover='over(event,this)' onmouseout='out(event,this)' title='"+
						 "<table cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed;font-size:13px;line-height:22px\">"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>索引号</b></td>"+
						 "<td>:"+(govInfoList[i].searchCode==null?"":govInfoList[i].searchCode)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td  valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>分类</b></td>"+
						 "<td>:"+(govInfoList[i].categoryName==null?"":govInfoList[i].categoryName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布机构</b></td>"+
						 "<td>:"+(govInfoList[i].orgName==null?"":govInfoList[i].orgName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布日期</b></td>"+
						 "<td>:"+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"</td>"+
						 "</tr><tr><td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>名称</b></td>"+
						 "<td>:"+(govInfoList[i].title==null?"":govInfoList[i].title)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>文号</b></td>"+
						 "<td>:"+(govInfoList[i].fwwh==null?"":govInfoList[i].fwwh)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>关键字</b></td>"+
						 "<td>:"+(govInfoList[i].keywords==null?"":govInfoList[i].keywords)+"</td>"+
						 "</tr>"+
						 "</table>'>";
					if(govInfoList[i].title.length>25){
						html += govInfoList[i].title.substring(0,25)+"...";
					} else {
						html += govInfoList[i].title;	
					} 
					html += "</a></div></td><td></td><td><div class=\"time\" style=\"float:right\">["+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"]</div></td>";
					html += "</tr>";
				}
				}
				html += "</tbody></table>";
				if(position != "" && position != null){
					$(".c"+position).html("");
					$(".c"+position).html(html);
				}
			
			},
			error:function(){
				//alert("出错了！");
			}
		});
		return html;
	}
	
/**
 * ajax事件获取某公开目录的信息(企事业单位)
 * @param {} categoryId
 * @param {} subType
 * @param {} position
 * @return {}
 */
function changeSubCon(categoryId,subType,position){
	var html = "";
	var orgType = $("#orgType").val();
	$.ajax({
		url:"findSubTypeInfoList.action",
		dataType:"json",
		type:"POST",
		data:"categoryId="+categoryId+"&subType="+subType,
		async: false,
		success:function(data){
			var govInfoList = data.govInfoCyList;
			html += " <table class='tb1' border='0' cellpadding='0' cellspacing='0'>";
				html += "<tbody>";
				if(govInfoList != null && govInfoList.length >0){
				  for(var i=0;i<govInfoList.length;i++){
					html += "<tr>";
					html += "<td><div class='title'>·<a href='./loadGovInfo.action?detailFlg=index&forwardKey=homeSite&orgType="+orgType+"&affairSort="+govInfoList[i].affairSort+"&nid="+govInfoList[i].id+"' onmouseover='over(event,this)' onmouseout='out(event,this)' title='"+
						 "<table cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed;font-size:13px;line-height:22px\">"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>索引号</b></td>"+
						 "<td>:"+(govInfoList[i].searchCode==null?"":govInfoList[i].searchCode)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td  valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>分类</b></td>"+
						 "<td>:"+(govInfoList[i].categoryName==null?"":govInfoList[i].categoryName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布机构</b></td>"+
						 "<td>:"+(govInfoList[i].orgName==null?"":govInfoList[i].orgName)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>发布日期</b></td>"+
						 "<td>:"+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"</td>"+
						 "</tr><tr><td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>名称</b></td>"+
						 "<td>:"+(govInfoList[i].title==null?"":govInfoList[i].title)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>文号</b></td>"+
						 "<td>:"+(govInfoList[i].fwwh==null?"":govInfoList[i].fwwh)+"</td>"+
						 "</tr>"+
						 "<tr>"+
						 "<td valign=\"top\" width=\"80px\" style=\"text-align:justify;	text-justify:distribute-all-lines;\"><b>关键字</b></td>"+
						 "<td>:"+(govInfoList[i].keywords==null?"":govInfoList[i].keywords)+"</td>"+
						 "</tr>"+
						 "</table>'>";
					if(govInfoList[i].title.length>25){
						html += govInfoList[i].title.substring(0,25)+"...";
					} else {
						html += govInfoList[i].title;	
					} 
					html += "</a></div></td><td></td><td><div class=\"time\" style=\"float:right\">["+(govInfoList[i].fmAddTime==null?"":govInfoList[i].fmAddTime)+"]</div></td>";
					html += "</tr>";
				}
				}
				html += "</tbody></table>";
			if(position != "" && position != null){
				$("."+position).html("");
				$("."+position).html(html);
			}
		
		},
		error:function(){
			//alert("出错了！");
		}
	});
	return html;
}

/**
 * 显示统计信息
 * @param {} orgType
 */
function showStat(orgType) {
	$.ajax({
		url : "findInfoCountByYear.action",
		dataType : "json",
		type : "POST",
		data : "orgType=" + orgType,
		success : function(data) {
			var govInfoCountList = data.govInfoCountList;
			var html = "<ul>";
			if(govInfoCountList != null && govInfoCountList.length>0){
				for (var i = 0; i < govInfoCountList.length; i++) {
				  html += "<li><span style='float:left;'>"
					  if(govInfoCountList[i].orgCode.length>14){
						  html += govInfoCountList[i].orgCode.substring(0, 14)+"..";
					  }else{
						  html += govInfoCountList[i].orgCode;
					  }
				  html += "</span><span style='float:right;'>" + govInfoCountList[i].viewCnt + "</span></li>";
			}
			}
		
			html += "</ul>";
			$(".stat").html("");
			$(".stat").append(html);
		},
		error : function() {
			// alert("出错了！");
		}
	});

} 

/**
 * 动态获取公告水电信息
 */
function hydroelectricity(itemId){
		$.ajax({
		url : "findByItem.action",
		dataType : "json",
		type : "POST",
		data : "itemId=" + itemId,
		success : function(data) {
			var infoBean = data.infoBean;
			$("#notice").html("");
			if(infoBean != null && infoBean != "undefind"){
				$("#notice").html(infoBean.infoContent);
			}
		},
		error: function(){
			alert("error!");
		}
	});
}

	/**
	 * 生成市，县，政府部门，公企的主页
	 */
jQuery(function($){
	var orgType = $("#orgType").val();
	// 公共企事业单位
	if(orgType != null && orgType != ""){
		if (orgType == "5") {
		var orgType = $("#orgType").val();
		$.ajax({
			url : "findIndexCategtory.action",
			dataType : "json",
			type : "POST",
			data : "orgType=" + orgType,
			success : function(data) {
				var indexCategory = data.indexCategoryList;
				var html = "";
				var categoryId;
				for (var i = 0; i < indexCategory.length; i++) {
					categoryId = indexCategory[i].categoryId;
					html += "<div class='main_box' style=\"margin-top:10px\">";
					// 生成企业子类别
					html += "<ul class='main_title2'>"
							+ "<li class=\"font\">"+indexCategory[i].categoryName+"</li>"
							+ "<li onmouseover=\"changeSubCon("+categoryId+",1,'c"+i+"')\">卫生行业|</li>"
							+ "<li onmouseover=\"changeSubCon("+categoryId+",2,'c"+i+"')\">教育行业|</li>"
							+ "<li onmouseover=\"changeSubCon("+categoryId+",3,'c"+i+"')\">水电气行业|</li>"
							+ "<li onmouseover=\"changeSubCon("+categoryId+",4,'c"+i+"')\">其他</li>"
							+ "</ul>";
					html += "<div class='c"+ i + "'>";
					html += changeSubCon(categoryId, 1, "");
					html += "</div>";
					html += "</div>";

				}
				$(".main").html(html);
			},
			error : function() {
				// alert("出错了！");
			}
		});

	} else {
		$.ajax({
			url : "findIndexCategtory.action",
			dataType : "json",
			type : "POST",
			data : "orgType=" + orgType,
			success : function(data) {
				var indexCategory = data.indexCategoryList;
				var html = "";
				// 默认显示的公开目录信息
				var indexId;
				var categoryId;
				var lever = 0;
				// 默认每行显示4个
				for (var i = 0; i < indexCategory.length; i++) {
					categoryId = indexCategory[i].categoryId;
					// 若为新行
					if (i % 5 == 0) {
						lever = lever + 1;
						if (indexId != null && indexId != "") {
							html = html + "</ul><div class='c" + (lever - 1)
									+ "'>";
							html += changeCon(indexId, orgType,"", null);
							html += "</div></div>";
						}
						indexId = indexCategory[i].categoryId;
						html += '<div class="main_box" style="border:none;"><ul class="main_title1">';
					}
					html = html
							+ "<li style='margin-left:0;margin-right:6px' onmouseover=\"changeCon('"
							+ indexCategory[i].categoryId + "','" +orgType+"',"+ lever
							+ ",this)\" onmouseout=\"e(this)\">";
					html += "<span title='" + indexCategory[i].categoryName
							+ "'>"
					if (indexCategory[i].categoryName.length > 6) {
						html += indexCategory[i].categoryName.substring(0, 6)
								+ "..";
					} else {
						html += indexCategory[i].categoryName;
					}
					html += "</span></li>";
					if (i == indexCategory.length - 1) {
						html += "</ul><div class='c" + lever + "'>";
						html += changeCon(indexId,orgType, "", null);
						html += "</div></div>";
					}
				}
				$(".main").append(html);
			},
			error : function() {
				//alert("出错了！");
			}
		});

	}
	}	
});
function e(e){
	e.className="";
	}